package com.jiutian.action;


import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


public class MyAccountAction extends Action {
    public ActionForward execute(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException {
        HttpSession session = request.getSession();
        String usertype = (String) session.getAttribute("type");
        String mess;

        if (usertype == null) { //not login yet
            mess = "notlog";
        } else if (usertype.equals("h")) { // hotel user
            mess = "/hotel/manage/handleOrder.jsp";

            //			return mapping.findForward("hotelmanagepage");
        } else if (usertype.equals("a")) { //admin user
            mess = "/hotel/admin/manageHotelInfo.jsp";

            //			return mapping.findForward("adminpage");
        } else {
            mess = "err";
        }

        response.getWriter().print(mess);

        return null;
    }
}
